/**
 * Created by jondai on 2017/12/26.
 */





$(function(){

    //初始化Tree
    layui.use('tree', function() {
        layui.tree({
            elem: '#integralTree',  //传入元素选择器
            nodes: [{ //节点
                name: '基础培训积分',
                spread: true,
                children: [
                    {
                    name: '网络培训积分',
                    url: 'integral/network_train'
                    },{
                    name: '脱产培训积分',
                    url: 'integral/fulltime_train'
                    }]
                }, {
                    name: '奖励培训积分',
                    spread: true,
                    children: [{
                        name: '个人素质积分',
                        spread: true,
                        children: [{
                            name: '学历提升',
                            url: 'integral/degree_train'
                        },{
                            name: '执业资格',
                            url: 'integral/pro_tech_train'
                        },{
                            name: '职业资格',
                            url: 'integral/pro_qualify_train'
                        },
                            {
                            name: '专家人才',
                            url: 'integral/expert_train'
                        }]
                    },
                        {
                            name: '执业资格',
                            url: 'integral/practice_train'
                        },{
                        name: '竞赛调考积分',
                        url: 'contestRule/index'
                    },{
                        name: '培训能力积分',
                        spread: true,
                        children: [{
                            name: '兼职培训师',
                            url: 'integral/part_time_trainer'
                        },{
                            name: '师带徒',
                            url: 'integral/master'
                        },{
                            name: '培训项目开发',
                            url: 'integral/train_program'
                        }]
                    }]
                },
                { //节点
                    name: '统计项积分设置',
                    spread: true,
                    children: [
                        {
                            name: '星级分值设置',
                            url: 'integral/train_start'
                        }]
                }],
            click: function(node){
                if(node.url){
                    $.ajax({
                        type: "GET",
                        url: node.url,
                        dataType: "html",
                        success: function(data){
                            $('#integralContent').html(data);
                        }
                    });
                }
            }

    });
    });

    $.ajax({
        type: "GET",
        url: "integral/network_train",
        dataType: "html",
        success: function(data){
            $('#integralContent').html(data);
        }
    });
});
